#-------------------------------------------------------------------------------
# Name:        module1
# Purpose:
#
# Author:      Student
#
# Created:     16/07/2012
# Copyright:   (c) Student 2012
# Licence:     <your licence>
#-------------------------------------------------------------------------------

import random

class hangman:
    strikes=0
    def display(asdf, word):
        for x in word:
            print(x, end =" ")
    def guessLetter(asdf, guess, wordList, guessList):
        count=0
        for x in range(0,len(wordList)):
            if(wordList[x]==guess):
                guessList[x]=wordList[x]
            else:
                count+=1
        if(count==4):
            hangman.strikes+=1

def main():

    listOWords= list()
    listOWords.append("lawl")
    listOWords.append("qwerty")
    listOWords.append("bagel")
    listOWords.append("and")
    random.seed()
    wordList = list(listOWords[random.randint(0,3)])
    guessList = list("")
    for x in range(0,len(wordList)):
        guessList.append("_")
    hang=hangman()
    while(hang.strikes<6 and wordList!=guessList):
        hang.display(guessList)
        hang.guessLetter(input("Guess a letter: "),wordList,guessList)
        print()
        print("Strikes: ",end="\n")
        print(hang.strikes)
    hang.display(wordList)
    print()
    if(hang.strikes==6):
        print ("You lose!")
    else:
        print ("You win!")
    pass

if __name__ == '__main__':
    main()
